<?php
/* 
 * ********* CVS HEADER ********* 
 * 
 * $RCSfile: admenvchg.php,v $ 
 * $Date: 2005/08/29 13:18:37 $ 
 * $Revision: 1.2 $ 
 * 
 * ********* CVS HEADER ********* 
 */
if($argid!="") {
	$query="UPDATE session SET environnement='$argid' WHERE id='".$session['id_session']."'";
	rportalrequete($query) or rportalerreur($query,"?op=admenvliste");
	$session['environnement']=$argid;
	$_SESSION['session']=$session;
	header("Location: ?op=");
	exit;
}

$L_base_env = get_env_path();
require_once(get_path("module")."TPLN/TPLN.php");
$TPLN = new TPLN;
$TPLN->Open($op_basepath.get_path("tpl")."admenvchg.html");
$TPLN->IncludeFile("header",$L_base_env.$session['environnement']."/header.php");

require_once(get_path_module("admin")); 
$pc = new panneau_controle(); 
$pc->calculRubriqueParFonction($op); 
$TPLN->Parse("panneau_controle",$pc->retourneEntete());

$query="SELECT * FROM environnement GROUP BY id";
$result=rportalrequete($query) or rportalerreur($query,"?op=admenvliste");
$class[0]="liste_impaire";
$class[1]="liste_paire";
$L_classIndex=0;
while($row=rportalligne($result))
{
	$TPLN->Parse("bloc1.class",$class[$L_classIndex]);
	$TPLN->Parse("bloc1.nom",$row['nom']);
	$TPLN->Parse("bloc1.description",$row['nom']);
	$L_classIndex = 1-$L_classIndex;
	$TPLN->Loop("bloc1");
}
$TPLN->IncludeFile("footer",$L_base_env.$session['environnement']."/footer.php");
$TPLN->Write();
?>